<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="https://unpkg.com/vue@next"></script>
    <div id='app'>
        <!-- v-model绑定的属性可以理解为一种特殊的v-bind，v-model绑定的变量规则符合v-bind变量规则 -->
        <todo-item v-model:first-name="firstName" v-model:second-name="secondName"></todo-item>
    </div>
    <script>
        const vueOpt = {
            data(){
                return {
                    firstName: "kenny.bai",
                    secondName: "cur data"
                }
            }
        }

        const app = Vue.createApp(vueOpt);

        app.component('todo-item', {
            data(){
                return {

                }
            },

            props:{
                firstName: String,
                secondName: String
            },

            template:
            `
            <div>
                <input type="text" :value="firstName" @input="$emit('update:bar', $event.target.value)">
                <input type="text" :value="secondName" @input="$emit('update:foo', $event.target.value)">
            </div>
            `
        });

        app.mount('#app');
    </script>
</body>
</html>